package it.das.log;

import org.aspectj.lang.ProceedingJoinPoint;


public class TraceApplication {
	
	private int numberOfSpaces = 0;

	public void trace(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {  
		String methodName = proceedingJoinPoint.getSignature().getName();
		String className = proceedingJoinPoint.getTarget().getClass().getName();
		for (int i = 0; i < numberOfSpaces; i++) {
			System.out.print("**|");
		}
		System.out.println("**TRACE before: (" + methodName + ") of class (" + className + ")");
		numberOfSpaces = numberOfSpaces +1;
		proceedingJoinPoint.proceed();
		numberOfSpaces = numberOfSpaces -1;
		for (int i = 0; i < numberOfSpaces; i++) {
			System.out.print("**|");
		}
		System.out.println("**TRACE after : (" + methodName + ") of class (" + className + ")");
	}
}
